import {v4 as uuidv4} from 'uuid'

export function getUUID(){
  //1.浏览器有uuid
  let userTempId = localStorage.getItem('UUID_KEY')
  if(userTempId) return userTempId
  //2.生成uuid 保存到浏览器
   userTempId = uuidv4() 
   localStorage.setItem('UUID_KEY',userTempId)
  //3.返回
  return userTempId
}

//保存token
export function setToken(token){
  localStorage.setItem('TOKEN_KEY',token)
}
//删除token
export const removeToken = ()=>localStorage.removeItem('TOKEN_KEY')
//获取token
export const getToken = ()=>localStorage.getItem('TOKEN_KEY')
